﻿using System;
using System.Threading;


namespace FileData.Utils.Currency
{
    internal class ThreadSleep
    {/// <summary>
     /// 设置睡眠时间
     /// </summary>
     /// <param name="MaxTime"></param>
        public void SetClock(int MaxTime)
        {
            SetClock(0, MaxTime);
        }/// <summary>

        /// 设置睡眠时间
        /// </summary>
        /// <param name="MinTime"></param>
        /// <param name="MaxTime"></param>
        public void SetClock(int MinTime, int MaxTime)
        {
            int SleepRandom = new Random().Next(MinTime, MaxTime);

            SleepLog(SleepRandom);
        }

        private static void SleepLog(int SleepTime)
        {
            while (SleepTime >= 0)
            {
                PrintLog.Log(string.Format("程序休眠中，距离唤醒还有{0}秒。", SleepTime--), 0, 0);
                Console.WriteLine(DateTime.Now.ToString());
                Thread.Sleep(1000);
            }
            Console.WriteLine("程序休眠结束，继续运行。");
        }
    }
}